﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Forest.Cat.Domain.Entities;
using AutoMapper;
using Forest.Cat.Admin.Models.CoverLetters;
using Forest.Cat.Admin.Models.Homes;

namespace Forest.Cat.Admin {
    public static class MappingExtensions {
        #region CoverLetter
        public static CoverLetterModel ToModel(this CoverLetter entity) {
            return Mapper.Map<CoverLetter, CoverLetterModel>(entity);
        }
        public static CoverLetter ToEntity(this CoverLetterModel model) {
            return Mapper.Map<CoverLetterModel, CoverLetter>(model);
        }
        public static CoverLetter ToEntity(this CoverLetterModel model, CoverLetter destination) {
            return Mapper.Map(model, destination);
        }
        #endregion

        public static IndexModel ToModel(this JobPosition entity)
        {
            if (entity == null)
                throw null;

            var model = new IndexModel()
            {
                Id = entity.Id,
                JobTitle = entity.JobTitle,
                //JobDescription = entity.JobDescription,

                StartDate = entity.StartDate,
                Wants = entity.Wants,
                Contact = entity.Contact,
                Email = entity.Email,
                Tel = entity.Tel,
                //Fax = entity.Fax,
                EndDate = entity.EndDate
            };
            return model;
        }
    }
}